 package com.oanda.blackberry.ui;
 
 import net.rim.device.api.ui.Color;
 import net.rim.device.api.ui.Field;
 import net.rim.device.api.ui.FieldChangeListener;
 import net.rim.device.api.ui.Font;
 import net.rim.device.api.ui.Graphics;
 import net.rim.device.api.ui.component.CheckboxField;
 
 public class PlainSelectableEditField extends CheckboxField
 {
   Color fontColor;
   private int backgroundColorUnfocused = 4473924;
   static final int width = 90;
   static final int height = 24;
   int state = 0;
 
   boolean isFocused = false;
   String label;
   Font textFont;
   int fontHeight = 18;
 
   Font normal = Font.getDefault().derive(0, this.fontHeight);
 
   public PlainSelectableEditField(String label, int state, FieldChangeListener listener)
   {
     this.state = state;
     this.label = label;
     setLabel(label);
     setChangeListener(listener);
   }
 
   public String getLabel() {
     return this.label;
   }
 
   public void setState(int state) {
     this.state = state;
   }
 
   protected void layout(int maxWidth, int maxHeight) {
     setExtent(90, 24);
   }
 
   protected void paint(Graphics graphics)
   {
     if (this.textFont != null)
       graphics.setFont(this.textFont);
     else {
       graphics.setFont(this.normal);
     }
 
     if (this.isFocused) {
       graphics.setColor(this.backgroundColorUnfocused);
       graphics.fillRoundRect(0, 0, 90, 24, 5, 5);
       graphics.setColor(16119285);
       graphics.drawText(this.label, 5, 5);
     } else {
       graphics.setColor(this.backgroundColorUnfocused);
       graphics.drawText(this.label, 5, 5);
     }
   }
 
   public boolean isFocusable() {
     return true;
   }
 
   protected void drawFocus(Graphics graphics, boolean on)
   {
   }
 
   protected void onFocus(int direction) {
     this.isFocused = true;
     super.onFocus(direction);
     invalidate();
   }
 
   protected void onUnfocus() {
     this.isFocused = false;
     super.onUnfocus();
     invalidate();
   }
 
   public static int getCustomWidth() {
     return 90;
   }
 
   public static int getCustomHeight() {
     return 24;
   }
 
   public void setTextFont(Font textFont) {
     this.textFont = textFont.derive(0, this.fontHeight);
   }
}

